﻿using System;
using Microsoft.Phone.Controls;
//
using GalaSoft.MvvmLight.Messaging;
using ScheduleMVVM.Model.RuntimeFramework;
using ScheduleMVVM.ViewModel;

namespace ScheduleMVVM
{
    /// <summary>
    /// Description for AddFavouritePage.
    /// </summary>
    public partial class AddFavouritePage : PhoneApplicationPage
    {
        /// <summary>
        /// Initializes a new instance of the AddFavouritePage class.
        /// </summary>
        public AddFavouritePage()
        {
            InitializeComponent();
        }
        #region Application bar implementation
        private void Ok_Click(object sender, System.EventArgs e)
        {
            var context = (AddFavouriteViewModel)DataContext;
            context.Title = TitleTextBox.Text;
            context.SaveFavourite.Execute(null);
            //
            NavigationService.GoBack();
        }

        private void Cancel_Click(object sender, System.EventArgs e)
        {
            NavigationService.GoBack();
        }
        #endregion
        private void PhoneApplicationPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            TitleTextBox.Focus();
        }
    }
}